import Vue from 'vue'
import { ImagePreview } from 'vant'
Vue.use(ImagePreview)

export const getProImg = (imgName, img) => {
    if (process.env.NODE_ENV.includes('Cdn')) {
        return `${process.env.IMG_BASE_URL}/${imgName}`
    } else {
        return img
    }
}

// 图片预览，基于Vant
export const previewImgVant = ({imgSrc, imgList}) => {
    imgList = imgList.length > 0 ? imgList : [...imgSrc]
    ImagePreview({
        images: imgList,
        startPosition: imgList.indexOf(imgSrc) || 0,
        // closeable: true,
    })
}